/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package phoenixx;

import java.io.File;
import java.io.FileNotFoundException;

/**
 *
 * @author devashish
 */
public class Utility {

    public static String getExtension(String filename) {
        int index = filename.lastIndexOf('.');
        String ext = null;
        if (index != -1) {
            ext = filename.substring(index + 1, filename.length());
        }
        return ext;
    }

    public static String getExtension(File file) throws FileNotFoundException {
        String ext = null;
        if(file.isFile()) {
            ext = getExtension(file.getName());
        } else {
            throw new FileNotFoundException();
        }
        return ext;
    }
}
